#pragma once

#include <vector>
#include "AssemblyTemplate.h"

class MetaVariable;
class MetaClass;

namespace ECS
{
	class IComponent;

	class MemberValue
	{
	public:
		virtual void setValue(Component* component) = 0;

		MetaVariable*	variable;
	};

	template <typename T>
	class PODMemberValue : public MemberValue
	{
	public:
		virtual void setValue(Component* component) override
		{
			variable->setValue(component, &value);
		}

		T value;
	};

	struct ComponentConnection
	{
		// Identifier of signal
		TypeID	signal;

		// Identifier of component class
		TypeID	component;

		// identifier of slot method (name)
		TypeID	slot;
	};

	class ComponentTemplate : public IComponentTemplate
	{
	public:

		void initComponent(Component* component);

		virtual void afterInit(Component* component) override;

		virtual Component* create() override;

		MetaClass* classTable;
		std::vector<MemberValue*> values;
		std::vector<ComponentConnection> connections;
	};


}